<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="cn.edu.hziee.Grade" %>
<%@ page import="java.util.List" %>
<%--
  Created by IntelliJ IDEA.
  User: ykd95
  Date: 2022/4/23
  Time: 23:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改</title>
    <script src="jquery-3.6.0.js"></script>
    <script>
        function changeValue(obj){
            $(obj).attr("value",$(obj).val());
        }
        $(function () {
            $('.submit').click(function () {
                var Text=$(this).parent().parent().find("input:text");
                $.post("/Traversal/SubmitServlet",{
                    Number:Text.eq(0).val(),
                    Name:Text.eq(1).val(),
                    Chinese:Text.eq(2).val(),
                    Math:Text.eq(3).val(),
                    English:Text.eq(4).val(),
                });
                $(location).attr('href', 'http://localhost:8080/Traversal/score.jsp');
            })
        })
    </script>
</head>
<body>
<%
    Grade grade = new Grade();
%>
<c:choose>
    <c:when test="${sessionScope==null}"/>
    <c:otherwise>
        <%
            grade = (Grade) session.getAttribute("update");
        %>
    </c:otherwise>
</c:choose>



<table border="1">
    <tr>
        <td>&nbsp;学号&nbsp;</td>
        <td>&nbsp;姓名&nbsp;</td>
        <td>&nbsp;语文&nbsp;</td>
        <td>&nbsp;数学&nbsp;</td>
        <td>&nbsp;英语&nbsp;</td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    </tr>

    <tr>
        <td><input type="text" name="number" value="<%=grade.getNumber()%>" onchange="changeValue(this)"></td>
        <td><input type="text" name="name" value="<%=grade.getName()%>" onchange="changeValue(this)"></td>
        <td><input type="text" name="chinese" value="<%=grade.getChinese()%>" onchange="changeValue(this)"></td>
        <td><input type="text" name="math" value="<%=grade.getMath()%>" onchange="changeValue(this)"></td>
        <td><input type="text" name="english" value="<%=grade.getEnglish()%>" onchange="changeValue(this)"></td>
        <td><button class="submit" onclick="">提交</button></td>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    </tr>
</table>
</body>
</html>
